<template>
    <div class="bookView1">
        <div class="book_list_all">
            <ul>
                <li>
                    <img class="book_img" src="../img/无封面.jpg">
                    <div class="book_bg"></div>
                    <div class="book_button">
                        <span class="book_name">图书名1</span>
                        <br>
                        <span class="book_author">作者</span>
                    </div>
                </li>
                <li>
                    <img class="book_img" src="../img/无封面.jpg">
                    <div class="book_bg"></div>
                    <div class="book_button">
                        <span class="book_name">图书名1</span>
                        <br>
                        <span class="book_author">作者</span>
                    </div>
                </li>
                <li>
                    <img class="book_img" src="../img/无封面.jpg">
                    <div class="book_bg"></div>
                    <div class="book_button">
                        <span class="book_name">图书名1</span>
                        <br>
                        <span class="book_author">作者</span>
                    </div>
                </li>
            </ul>
        </div>
    </div>
</template>
<style lang="less" scoped>
.book_list_all {
    margin-top: 5px;
    ul {
        display: flex;
        width: 100vw;
        padding-bottom: 10px;
        
        li {
            text-align: center;
            flex-grow: 1;
            padding: 0 10px;
            margin: 5px;
            background-color: rgba(242, 255, 98, 0.1);
            display: inline-block;
            .book_img {
                object-fit: cover;
                width: 90px;
                height: 135px;
            }
            .book_name{
                color: black;
                font-weight: bold;
            }
            .book_author{
                color: gray;
            }
        }
    }
}
</style>

<script>
import { getbook } from '../api/request';
import axios from 'axios';


export default {
    name: 'Book1View',
        data() {
        return {
            arr: [],

        }
    },
    methods: {
        async getBook() {
            await getbook()
                .then(
                    content => {
                        console.log("--->", content)
                        let { code, result } = content;
                        if (code == 200) {
                            // 映射数组
                            let newArr = result;
                            return newArr;
                        }
                    }
                )
                .catch(
                    err => {
                        console.log("请求失败，请刷新", err)
                    }
                )
        },
        getmydata() {
            this.loading = true;
            axios.get('https://apis.netstart.cn/daodu/today_recommends')
                .then(require => {
                    this.loading = false;
                    this.arr = require.data;

                    console.log(require.data.lessons[0].provenance);
                    console.log(require.data.lessons[0].author.name);

                })
                .catch(error => {
                    console.log(error);
                    this.loading = false;
                })
        }
    },
    mounted() {
        this.getmydata();
    },
}

</script>